package com.chrissen.cartoon.dao.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.chrissen.cartoon.dao.greendao.Book;
import com.chrissen.cartoon.dao.greendao.Txt;
import com.chrissen.cartoon.dao.greendao.User;

import com.chrissen.cartoon.dao.greendao.BookDao;
import com.chrissen.cartoon.dao.greendao.TxtDao;
import com.chrissen.cartoon.dao.greendao.UserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig bookDaoConfig;
    private final DaoConfig txtDaoConfig;
    private final DaoConfig userDaoConfig;

    private final BookDao bookDao;
    private final TxtDao txtDao;
    private final UserDao userDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        bookDaoConfig = daoConfigMap.get(BookDao.class).clone();
        bookDaoConfig.initIdentityScope(type);

        txtDaoConfig = daoConfigMap.get(TxtDao.class).clone();
        txtDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        bookDao = new BookDao(bookDaoConfig, this);
        txtDao = new TxtDao(txtDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);

        registerDao(Book.class, bookDao);
        registerDao(Txt.class, txtDao);
        registerDao(User.class, userDao);
    }
    
    public void clear() {
        bookDaoConfig.clearIdentityScope();
        txtDaoConfig.clearIdentityScope();
        userDaoConfig.clearIdentityScope();
    }

    public BookDao getBookDao() {
        return bookDao;
    }

    public TxtDao getTxtDao() {
        return txtDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

}
